package xyz.keyon.listener;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * @author Keyon
 * @explain ServletContextListener监听器
 *          监听ServletContext域的创建与销毁。
 * @creat time 2019/10/27 17:07
 */
public class MyServletContextListener implements ServletContextListener {

    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        ServletContext servletContext = servletContextEvent.getServletContext(); //获取被监听对象
        System.out.println("context init...");
    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {
        System.out.println("context destorying...");
    }
}
